import { lazy } from "react"
import { Navigate } from "react-router-dom"

// 登录
const LoginComponent = lazy(() => import("../view/login"))
// 注册
const RegisterComponent = lazy(() => import("../view/register"))
// 忘记密码
const ForgetPasswordComponent = lazy(() => import("../view/forgetPassword"))
// 邮箱验证
const EmailVerificationComponent = lazy(() => import("../view/emailVerification"))

// 首页
const HomeComponent = lazy(() => import("../view/home"))
// 上传文件
const UploadFileComponent = lazy(() => import("../view/home/uploadFile"))
// 仪表盘
const PanelComponent = lazy(() => import("../view/home/panel"))
// 文本文件
const TextFileComponent = lazy(() => import("../view/home/textFile"))
// 图片文件
const ImageFileComponent = lazy(() => import("../view/home/imageFile"))
// 视频文件
const VideoFileComponent = lazy(() => import("../view/home/videoFile"))
// 音频文件
const AudioFileComponent = lazy(() => import("../view/home/audioFile"))
// 其他文件
const OtherFileComponent = lazy(() => import("../view/home/otherFile"))
// 404页面
// const NotFoundComponent = lazy(() => import("../view/notFound"))

// 我的页面
const MyComponent = lazy(() => import("../view/my"))
// 用户页面
const UserComponent = lazy(() => import("../view/my/user"))
// 最近文件
const RecentFileComponent = lazy(() => import("../view/my/recentFile"))
// 邀请成员
const InviteMemberComponent = lazy(() => import("../view/my/inviteMember"))
// 回收站
const RecycleBinComponent = lazy(() => import("../view/my/recycleBin"))
// 历史记录
const HistoryFileComponent = lazy(() => import("../view/my/historyFile"))








const routes = [
    { path: '/', element: <Navigate to='/login' /> },
    // 登录
    { path: '/login', element: <LoginComponent /> },
    // 注册
    { path: '/register', element: <RegisterComponent /> },
    // 忘记密码
    { path: '/forgetpassword', element: <ForgetPasswordComponent /> },
    // 邮箱验证
    { path: '/emailverification', element: <EmailVerificationComponent /> },
    // 首页
    {
        path: '/home', element: <HomeComponent />,
        children: [
            // 上传文件
            // { path: 'uploadfile', element: <UploadFileComponent /> },
            // 仪表盘
            { path: 'panel', element: <PanelComponent /> },
            // 文本文件
            { path: 'textfile', element: <TextFileComponent /> },
            // 图片文件
            { path: 'imagefile', element: <ImageFileComponent /> },
            // 视频文件
            { path: 'videofile', element: <VideoFileComponent /> },
            // 音频文件
            { path: 'audiofile', element: <AudioFileComponent /> },
            // 其他文件
            { path: 'otherfile', element: <OtherFileComponent /> },
        ]
    },

    // 我的页面
    {
        path: '/my', element: <MyComponent />,
        children: [
            // 用户页面
            { path: 'user', element: <UserComponent /> },
            // 最近文件
            { path: 'recentfile', element: <RecentFileComponent /> },
            // 邀请成员
            { path: 'invitemember', element: <InviteMemberComponent /> },
            // 回收站
            { path: 'recyclebin', element: <RecycleBinComponent /> },
            // 历史记录
            { path: 'historyfile', element: <HistoryFileComponent /> },
            // 退出登录
            { path: 'logout', element: <Navigate to='/login' /> },
        ]
    },
]

export default routes

